package com.irdstudio.rsp.rule.api.rest;

import com.irdstudio.rsp.rule.service.facade.BizRuleLogService;
import com.irdstudio.rsp.rule.service.vo.BizRuleLogVO;
import com.irdstudio.sdk.beans.core.vo.ResponseData;
import com.irdstudio.sdk.beans.web.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api")
public class BizRuleLogController extends AbstractController  {
	
	@Autowired
	@Qualifier("bizRuleLogServiceImpl")
	private BizRuleLogService bizRuleLogService;

	
	/**
	 * 列表数据查询
	 * @param page
	 * @param size
	 * @return
	 */
	@RequestMapping(value="/biz/rule/logs", method=RequestMethod.POST)
	public @ResponseBody ResponseData<List<BizRuleLogVO>> queryBizRuleLogAll(
			BizRuleLogVO vo) {		
		List<BizRuleLogVO> outputVo = bizRuleLogService.queryAllOwner(vo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键查询详情
	 * @return
	 */
	@RequestMapping(value="/biz/rule/log/{logId}", method=RequestMethod.GET)
	public @ResponseBody ResponseData<BizRuleLogVO> queryByPk(@PathVariable("logId") String logId) {		
		BizRuleLogVO inVo = new BizRuleLogVO();
				inVo.setLogId(new String(logId));
		BizRuleLogVO outputVo = bizRuleLogService.queryByPk(inVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键删除信息
	 * @param bizRuleLog
	 * @return
	 */
	@RequestMapping(value="/biz/rule/log", method=RequestMethod.DELETE)
	public @ResponseBody ResponseData<Integer> deleteByPk(@RequestBody BizRuleLogVO inBizRuleLogVo) {		
		int outputVo = bizRuleLogService.deleteByPk(inBizRuleLogVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键更新信息
	 * @param inBizRuleLogVo
	 * @return
	 */
	@RequestMapping(value="/biz/rule/log", method=RequestMethod.PUT)
	public @ResponseBody ResponseData<Integer> updateByPk(@RequestBody BizRuleLogVO inBizRuleLogVo) {		
		int outputVo = bizRuleLogService.updateByPk(inBizRuleLogVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 新增数据
	 * @param inBizRuleLogVo
	 * @return
	 */
	@RequestMapping(value="/biz/rule/log", method=RequestMethod.POST)
	public @ResponseBody ResponseData<Integer> insertBizRuleLog(@RequestBody BizRuleLogVO inBizRuleLogVo) {
		int outputVo = bizRuleLogService.insertBizRuleLog(inBizRuleLogVo);
		return getResponseData(outputVo);
		
	}
}
